/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package observerswing;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Francisco
 */
public class Controladora {

    private List<Observer> observadores;
    private static Controladora instance;

    static {
        Controladora.instance = new Controladora();
    }

    public static Controladora getInstance() {
        return Controladora.instance;
    }

    private Controladora() {
        this.observadores = new ArrayList<Observer>();
    }

    public void registrar(Observer observer) {
        this.observadores.add(observer);
    }

    public void enviarMensaje(String text) {
        for (Observer o : this.observadores) {
            o.notificar(text);
        }
    }
}
